//
// Created by 吴锐 on 2022/2/27.
//

#include "iostream"
#include "fstream"

using namespace std;

class person {
public:
    char name[64];
    int age;
};

void test01(){
    ifstream ifs;

    ifs.open("person.txt", ios::in | ios::binary);

    if(!ifs.is_open()){
        cout << "文件打开失败" << endl;
        return;
    }

    person p;

    ifs.read((char*)& p, sizeof(person));

    cout << "姓名: " << p.name << " 年龄: " << p.age << endl;

    ifs.close();
}

int main(){
    test01();
    return 0;
}